package com.rabbit.helloword;

import java.io.IOException;

import com.rabbit.RabbitFactory;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

/**
 * @author CUIJIAJUN
 * @date 2017年2月15日
 * 
 */
public class Send {
	private final static String QUEUE_NAME = "helloword";

	public static void main(String[] args) throws IOException {
		Connection connection = RabbitFactory.creatConnection();
		Channel channel = connection.createChannel();
		channel.queueDeclare(QUEUE_NAME, false, false, false, null);
		String message = "hello world！";
		channel.basicPublish("", QUEUE_NAME, null, message.getBytes());
		System.out.println("发送成功");
		channel.close();
		connection.close();
	}
}
